{{ $links := .Site.Params.links }}
{{ $contributionGuidelines := "" }}
{{- with index $links "community" -}}
  {{ range . }}
    {{ $contributionGuidelines := .url }}
    {{ break }}
  {{ end }}
{{- end -}}

<section class="row td-box td-box--4 td-box--gradient td-box--height-auto linkbox">
    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
        <h2>{{ T "community_learn" }}</h2>
        <p>{{ T "community_using" . }}</p>
        {{ with index $links "user"}}
        {{ template "community-links-list" . }}
        {{ end }}
    </div>
    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
        <h2>{{ T "community_develop" }}</h2>
        <p>{{ T "community_contribute" . }}</p>
        {{ with index $links "developer"}}
        {{ template "community-links-list" . }}
        {{ end }}
        {{ with .Site.Params.contribution_guidelines_url }}
        <!-- https://k8s.dev/ did not support localization (as of 2024-08-12) -->
        <p>{{ T "community_advice_guidelines" (dict "link" (printf "<a href=\"%s\" target=\"_blank\">%s</a>" . ( T "community_guideline" ) ) ) | safeHTML }}</p>
        {{ end }}
    </div>
</section>

{{ define "community-links-list" }}
<ul>
    {{ range . }}
    <li title="{{ T .name_key }}">
        <a target="_blank" rel="noopener" href="{{ .url }}"><i class="{{ .icon }}"></i> {{ T .name_key }}</a>
    </li>
    {{ end }}
</ul>
{{ end }}
